#include "threadmanager.h"

ThreadManager::ThreadManager()
{
    controller1 = QSharedPointer<TcpHelper>(new TcpHelper);
    controller2 = QSharedPointer<TcpHelper>(new TcpHelper);

    task1 = QSharedPointer<QThread>(new QThread());
    task2 = QSharedPointer<QThread>(new QThread());

    init();
}

ThreadManager::~ThreadManager()
{
    controller1.clear();
    controller2.clear();
    task1.clear();
    task2.clear();
}

void ThreadManager::init()
{
    controller1->moveToThread(task1.get());
    controller2->moveToThread(task2.get());

    task1->start();
    task2->start();
}
